]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
ibusManager: Simplify code and logic for setEngine()
authorSundeep Mediratta <smedius@gmail.com>
Sun, 4 Aug 2024 17:24:17 +0000 (13:24 -0400)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 5 Sep 2024 11:09:38 +0000 (13:09 +0200)
Reword names, functions and refactor code to make code execution logic
simpler to understand.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3439>

js/misc/ibusManager.js

index 8d49735648a7cfa143f74be8bbb24c4d27886458..0462b2d6ae4a60b7d400236d706c3af1bf129a54 100644 (file)
@@ -294,16 +294,21 @@ class IBusManager extends Signals.EventEmitter {
 
     async setEngine(id) {
         if (this._oskCompletion)
-            this._preOskEngine = id;
+            await this._maybeUpdateCompletion(id);
+        else
+            await this._setEngine(id);
+    }
 
-        const isXkb = id.startsWith('xkb:');
-        if (this._oskCompletion && isXkb)
+    async _maybeUpdateCompletion(id) {
+        if (!this._oskCompletion)
             return;
 
-        if (this._oskCompletion)
+        this._preOskEngine = id;
+        const isXkb = id.startsWith('xkb:');
+
+        /* Non xkb engines conflict with completion */
+        if (!isXkb)
             await this.setCompletionEnabled(false);
-        else
-            await this._setEngine(id);
     }
 
     preloadEngines(ids) {